/**
 * 
 */
package com.shine.icis.hbean;

import java.text.DecimalFormat;

import com.shine.icis.config.SysCodeDictLoader;
import com.shine.icis.util.Tools;

/**
 * 对应部分A13应收应付信息
 * @author zsy
 *
 */
public class StockChk {
	//private DecimalFormat doubleFormat = new DecimalFormat("0.00");

	private Long id;
	private Integer branchNo;//营业部分支
	private String exchangeType;//交易类别
	private String taCode;//TA代码
	private String stockAccount;//股东代码
	private String stockCode;//证券代码
	private Integer fundAccount;//资金账号
	private String clientId;//客户号
	private String stockType;//证券类别
	private double dzAmount;//中登份额
	private double hsAmount;//恒生柜台份额
	private String diffType;//差异类别
	private String compType;//比较类别
	private String note;//备注
	private int busiDate;//业务日期
	private int operDate;//操作日期
	private int operTime;//操作时间
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Integer getBranchNo() {
		return branchNo;
	}
	public void setBranchNo(Integer branchNo) {
		this.branchNo = branchNo;
	}
	//交易类别
	public String getExchangeType() {
		return exchangeType;
	}
	public String getExchangeTypeNote() {
		if (exchangeType.equals("1")){
			return("1：上海A股");
		} else if (exchangeType.equals("2")){
			return("2：深圳A股");
		} else if (exchangeType.equals("9")){
			return("9：特转A股");
		} else if (exchangeType.equals("A")){
			return("A：特转B股");
		} else if (exchangeType.equals("D")){
			return("D：上海B股");
		} else if (exchangeType.equals("H")){
			return("H：深圳B股");
		} else {
			return("OF：场外开放式基金");
		} 
	}
	public void setExchangeType(String exchangeType) {
		this.exchangeType = exchangeType;
	}
	public String getTaCode() {
		return taCode;
	}
	public void setTaCode(String taCode) {
		this.taCode = taCode;
	}
	//股东代码
	public String getStockAccount() {
		return stockAccount;
	}
	public void setStockAccount(String stockAccount) {
		this.stockAccount = stockAccount;
	}
	//证券代码
	public String getStockCode() {
		return stockCode;
	}
	public void setStockCode(String stockCode) {
		this.stockCode = stockCode;
	}
	//资金账号
	public Integer getFundAccount() {
		return fundAccount;
	}
	public void setFundAccount(Integer fundAccount) {
		this.fundAccount = fundAccount;
	}
	//客户号
	public String getClientId() {
		return clientId;
	}
	public void setClientId(String clientId) {
		this.clientId = clientId;
	}
	//证券类别
	public String getStockType() {
		return stockType;
	}
	public void setStockType(String stockType) {
		this.stockType = stockType;
	}
	//中登份额
	public double getDzAmount() {
		return dzAmount;
	}
	public void setDzAmount(double dzAmount) {
		this.dzAmount = dzAmount;
	}
	//恒生柜台份额
	public double getHsAmount() {
		return hsAmount;
	}
	public void setHsAmount(double hsAmount) {
		this.hsAmount = hsAmount;
	}
	//差异类别
	public String getDiffType() {
		return diffType;
	}
	public String getDiffTypeNote() {
		if (diffType.equals("0")){
			return("0：中登有，柜台有，但份额不一致");
		} else if (diffType.equals("1")){
			return("1：中登有，柜台无");
		} else 
			return("2：中登无，柜台有");
	}
	public void setDiffType(String diffType) {
		this.diffType = diffType;
	}
	//比较类别
	public String getCompType() {
		return compType;
	}
	public String getCompTypeNote() {
		if (compType.equals("0")){
			return("0：初始数据");
		} else if (compType.equals("1")){
			return("1：当前与历史一致");
		} else if (compType.equals("2")){
			return("2：当前有，历史有，但份额不一致");
		} else if (compType.equals("3")){
			return("3：当前有，历史无");
		} else 
			return("4：当前无，历史有");
	}
	public void setCompType(String compType) {
		this.compType = compType;
	}
	//备注
	public String getNote() {
		return note;
	}
	public void setNote(String note) {
		this.note = note;
	}
	//业务日期
	public int getBusiDate() {
		return busiDate;
	}
	public String getFormatBusiDate() {
		StringBuffer date = new StringBuffer(Integer.toString(busiDate));
		date.insert(6, "-").insert(4, "-");
		return date.toString();
	}
	public void setBusiDate(int busiDate) {
		this.busiDate = busiDate;
	}
	//操作日期
	public int getOperDate() {
		return operDate;
	}
	public void setOperDate(int operDate) {
		this.operDate = operDate;
	}
	//操作时间
	public int getOperTime() {
		return operTime;
	}
	public void setOperTime(int operTime) {
		this.operTime = operTime;
	}
	public String getFormatOperTime() {
		StringBuffer sb = new StringBuffer();
		sb.append(operDate);
		if (sb.length() != 8) {
			return "";
		}
		sb.insert(6, "-").insert(4, "-");
		//121200 -> 12:12:00
		StringBuffer sbt = new StringBuffer();
		sbt.append(Tools.getFixedNum(operTime, 6));
		sbt.insert(4, ":").insert(2, ":").toString();
		
		return sb.append(" ").append(sbt).toString();
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final StockChk other = (StockChk) obj;
		if (id == null) {
//			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	
	
	
}
